from django.db import models

# Create your models here.
from django.contrib.auth.models import AbstractUser
from django.utils.timezone import now


class User(AbstractUser):
    usertypelist = (
        (1, "管理员"),
        (2, "一般用户")
    )

    mobile = models.CharField('手机号', null=True, max_length=11, unique=True, help_text='手机号',
                              error_messages={'unique': '此手机号码已注册'})
    usertype = models.CharField(choices=usertypelist, default=None, max_length=5, null=True)
    first_name = None
    last_name = None
    createdtime = models.DateTimeField(default=now)
    date_joined = None

    class Meta(object):
        ordering = ("-createdtime",)
        db_table = "users"
